<template>
  <div class="page_top">
    <el-pagination
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      layout="total, prev, pager, next, sizes"
      :current-page.sync="pageData.pageNum"
      :page-size="pageData.pageSize"
      :total="pageData.total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "Pagination",
  data() {
    return {}
  },

  props: {
    pageData: {
      type: Object,
      default: {
        pageNum: 0,
        pageSize: 20,
        total: 0,
      }
    }
  },

  methods: {
    handleSizeChange(val) {
      this.$emit("pageSize", val);
    },

    handleCurrentChange(val) {
      this.$emit("pageNum", val);
    }
  }
}
</script>

<style scoped>
.page_top {
  margin: 16px 0;
  text-align: center;
}
</style>
